<?php

class ClientController extends Controller
{
	/**
	 * @var string the default layout for the views. Defaults to '//layouts/column2', meaning
	 * using two-column layout. See 'protected/views/layouts/column2.php'.
	 */
	public $layout='//layouts/column2';

	public function actionProfile() {
		$client = Client::model()->findByPk(Yii::app()->user->getState('id'));
        // var_dump($client);die();
		$this->render('profile', array('model' => $client));
	}

	public function actionSettings() {
		$this->render('settings');
	}

	public function actionBucket() {
		$this->render('bucket');
	}

	public function actionFinance() {
		$this->render('finance');
	}

	public function actionGarage() {
		$this->render('garage');
	}

	public function actionloyaltyProgram() {
		$this->render('loyalty-program');
	}

	public function actionOrders() {
		$this->render('orders');
	}

	/**
	 * @return array action filters
	 */
	public function filters()
	{
		return array(
			'accessControl', // perform access control for CRUD operations
			'postOnly + delete', // we only allow deletion via POST request
		);
	}

	/**
	 * Specifies the access control rules.
	 * This method is used by the 'accessControl' filter.
	 * @return array access control rules
	 */
	public function accessRules()
	{
		return array(
			// array('allow',  // allow all users to perform 'index' and 'view' actions
			// 	'actions'=>array('index','view'),
			// 	'users'=>array('*'),
			// ),
			array('allow', // allow authenticated user to perform 'create' and 'update' actions
				'actions'=>array('bucket','finance', 'garage', 'loyaltyProgram', 'orders', 'profile', 'settings'),
				'users'=>array('@'),
			),			
			array('deny',  // deny all users
				'users'=>array('*'),
			),
		);
	}

}
